package inf.coach.mobile;

import java.util.List;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;

import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class CommentText extends Activity {
	

	public static long comment_id;
	
public void onCreate(Bundle savedInstanceState) {
	 super.onCreate(savedInstanceState);
	 setContentView(R.layout.commenttext);
	 setTitle("Text Kommentar Informationen");
	 
	 TextView commentText = null;
	 Bundle bundle = this.getIntent().getExtras();      
	 comment_id = bundle.getLong("comment_id");
	 commentText=(TextView) findViewById(R.id.textView_comment);
	 if(ConnectionReceiver.isInternetConnected(getApplicationContext()))
		{
				String com=webservice.getCommentText(comment_id);
				System.out.println(com);
				commentText.setText(com.toString());
		}	
	else{
		message.show(CommentText.this,"Fehler", "Keine Internetverbindung !");
					//mTts.speak("Information Window, Error, There is no Internet Connection , Ok button", TextToSpeech.QUEUE_FLUSH, null);
		}
	 }

protected void dialoggoback() { 
    AlertDialog.Builder builder = new Builder(CommentText.this); 
    builder.setMessage("Möchten Sie zur letzten Seite zurück springen?"); 
    builder.setTitle("Information"); 
    builder.setPositiveButton("ok", 
            new android.content.DialogInterface.OnClickListener() { 
                @Override 
                public void onClick(DialogInterface dialog, int which) { 
                    dialog.dismiss(); 
                    CommentText.this.finish(); 
                }

            }); 
    builder.setNegativeButton("abbrechen", 
            new android.content.DialogInterface.OnClickListener() { 
                @Override 
                public void onClick(DialogInterface dialog, int which) { 
                    dialog.dismiss(); 
                } 
            }); 
    builder.create().show(); 
} 
@Override 
public boolean onKeyDown(int keyCode, KeyEvent event) { 
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { 
        dialoggoback(); 
        return false; 
    } 
    return false; 
} 
}
